<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <script src="https://cdn.bootcdn.net/ajax/libs/angular.js/1.6.8/angular.min.js"></script>
  </head>
  <body>
    <div ng-app="myApp" ng-controller="myCtrl">
      <h1>{{indexName}}</h1>
      <section>
          <div ng-repeat="_i in arr track by $index">序号:{{$index}} 内容:{{_i}}</div>
      </section>
    </div>

    <script>
      var app = angular.module("myApp", []);
      app.controller("myCtrl", function ($scope) {
        $scope.indexName = "主页";
        $scope.arr = [1,1,2,3,4,5] // 不加track by $index 就会报错 angular.js:14791 Error: [ngRepeat:dupes]
        /*
            如果当前数据有id的话，尽量使用track by _i.id
        */

      });
    </script>
  </body>
</html>
